import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:此类进行简单测验
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2024-01-03  09:40
 */

public class Main {
    public static User login() {
        System.out.println("《欢迎使用图书管理系统》");
        Scanner scanner = new Scanner(System.in);

        System.out.println("请选择您的身份：");
        System.out.println("0. 管理员  1. 普通用户");
        System.out.print("请输入你选择的数字:>");
        int choice = scanner.nextInt();

        if(choice == 0) {
            return new AdminUser("admin","2240110420");
        }else {
            return new NormalUser();
        }
    }
    public static void main(String[] args) {
        //使用线性表来存储书籍
        BookList bookList = new BookList();
        //实现向上转型
        User user = login();
        while(true){
            //动态绑定
            int choice = user.menu();
            //通过choice来调用对象
            user.doOpreation(choice,bookList);
        }
    }
}
